//
//  InputPhoneView.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 16/6/11.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "InputPhoneView.h"


@implementation InputPhoneView

- (void)textFieldDidBeginEditing:(UITextField *)textField {
    NSLog(@"%s",__func__);
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = [UIColor whiteColor];
        
        UILabel *phoneLabel = [[UILabel alloc] init];
        phoneLabel.text = @"手机号码:";
        phoneLabel.font = [UIFont systemFontOfSize:17];
        [self addSubview:phoneLabel];
        phoneLabel.textColor = [UIColor grayColor];
        
        self.phoneNumText = [[UITextField alloc] init];
        _phoneNumText.placeholder = @"请输入手机号码";
        [self addSubview:_phoneNumText];
        _phoneNumText.borderStyle = UITextBorderStyleRoundedRect;
        _phoneNumText.font = [UIFont systemFontOfSize:14];
        _phoneNumText.textColor = [UIColor blackColor];
        _phoneNumText.keyboardType = UIKeyboardTypeNumberPad;
        
        self.belongLabel = [[UILabel alloc] init];
        [self addSubview:_belongLabel];
        _belongLabel.text = @"手机号码归属地";
        _belongLabel.font = [UIFont systemFontOfSize:14];
        _belongLabel.textColor = [UIColor grayColor];
        
        CGFloat leftMargin = 15;
        
        [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).with.offset(leftMargin);
            make.centerY.equalTo(self.mas_centerY).offset(-10);
            make.height.mas_equalTo(40);
            
        }];
        
        [_phoneNumText mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(phoneLabel.mas_right).with.offset(leftMargin);
            make.centerY.equalTo(phoneLabel.mas_centerY);
            make.width.mas_equalTo(WIDTH * 0.60);
            make.height.mas_equalTo(40);
        }];
        
        [_belongLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_phoneNumText.mas_left);
            make.top.equalTo(_phoneNumText.mas_bottom).offset(10);
        }];
        
    }
    return self;
}



@end
